#ifndef SERVER_H
#define SERVER_H

#include <QTcpServer>
#include <QObject>


class Server : public QTcpServer
{
    Q_OBJECT
public:
    Server(QObject *parent=0);

public slots:
    void updateClients();
    void slotDisconnected();
    void onNewConnection();
    void startServer();

private:
    QTcpServer *tcpServer;
    QList<QTcpSocket*> clients;//用来保存与每一个客户端连接的TcpClientSocket
    QList<QTcpSocket*> chat;   //用来保存单人聊天
    QList<QTcpSocket*> groupChat;
    QList<QTcpSocket*> onlinepeople;

    void broadcastMessage(const QJsonObject& dataObject);
};

#endif // SERVER_H
